<?php

$page = "logs";

require 'require.php';

if (isset($_GET['s']) && ($_GET['s'])) {
	$start = $_GET['s'];
} else {
	$start = 0;
}

$link_server = mysql_connect(OPENIDOO_DB_SERVER, OPENIDOO_DB_USER, OPENIDOO_DB_PASSWORD);
$select_db = mysql_select_db(OPENIDOO_DB_DATABASE, $link_server);

if ((!$link_server) or (!$select_db)) {
	die('Impossible de se connecter');
} else {

	if (!($sql_logs = mysql_query("SELECT SQL_CALC_FOUND_ROWS user_id, date, log FROM openidoo_logs WHERE user_id='".mysql_escape_string($_SESSION['user_id'])."' ORDER BY date DESC LIMIT ".mysql_escape_string($start).",20", $link_server))) {
		die('Une erreur est survenue');
	}

	if (!($sql_logs_total = mysql_query("SELECT FOUND_ROWS() as 'total'", $link_server))) {
		die('Une erreur est survenue');
	} else {
		$total_logs = mysql_result($sql_logs_total, 0, 'total');
	}
}

require "html/top.html";
require "html/logs.html";
require "html/bottom.html";

?>
